class Matrix:

    def __init__(self,list2d):
        self._values = [row[:] for row in list2d]

    def shape(self):
        """矩阵的形状 (行数，列数) ( [1,2], [3,4] )"""
        return len(self._values), len(self._values[0])

    def __getitem__(self, item):
        """矩阵的坐标点 对应的元素 item 接收一个元组"""
        r, c = item
        return self._values[r][c]

    def row_vector(self):
        """返回矩阵的行向量"""

    def col_vector(self):
        """返回矩阵的列向量"""

    def dot(self):
        """矩阵的点乘"""

    def size(self):
        """矩阵元素的个数"""
        # row_num * clo_num
        r, c = self.shape()
        return r * c

    def row_num(self):
        """矩阵行个数"""
        return self.shape()[0]

    def col_num(self):
        """矩阵列个数"""
        return self.shape()[1]

    def __len__(self):
        """矩阵的长度 也就是row_num"""
        return self.row_num()

    def __repr__(self):
        return "Matrix({})".format(self._values)

    __str__ = __repr__

